package com.bawei.module_shop;

import android.widget.CheckBox;

import com.bawei.library_base.room.good.Good;
import com.bawei.library_base.utils.GlideUtil;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * @author : zhiyu
 * @date : 2021/12/16
 * @content :
 */
public class ShopAdapter extends BaseQuickAdapter<Good, BaseViewHolder> {



    public ShopAdapter(@Nullable List<Good> data) {
        super(R.layout.shopp_item, data);
        addChildClickViewIds(R.id.check);
        addChildClickViewIds(R.id.jia);
        addChildClickViewIds(R.id.jian);

    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, Good good) {
        baseViewHolder.setText(R.id.item_name,""+good.getName());
        baseViewHolder.setText(R.id.item_price,""+good.getPrice());
        baseViewHolder.setText(R.id.shuliang,""+good.getCount());
        GlideUtil.getInstance().LoadImage(getContext(),good.getImgUrl(),baseViewHolder.getView(R.id.item_img));
        CheckBox checkBox = baseViewHolder.getView(R.id.check);
        checkBox.setChecked(good.isCheck());

    }







}
